#
# SPDX-License-Identifier: Apache-2.0
#
---
{%+ if product_version is version('2.5.1', '>=') %}
apiVersion: ibp.com/v1beta1
{%+ elif product_version is version('2.5.0', '>=') %}
apiVersion: ibp.com/v1alpha2
{%+ else %}
apiVersion: ibp.com/v1alpha1
{% endif %}
kind: IBPConsole
metadata:
  name: "{{ console }}"
spec:
  arch:
  - "{{ arch }}"
{%+ if product_version is version('2.5.1', '>=') %}
  license:
    accept: true
{%+ else %}
  license: accept
{% endif %}
  serviceAccountName: "{{ service_account }}"
  email: "{{ console_email }}"
  password: "{{ console_default_password }}"
  registryURL: "{{ image_registry_url }}"
{%+ if product_version is version('2.5.0', '>=') %}
  imagePullSecrets:
  - "{{ image_pull_secret }}"
{%+ else %}
  imagePullSecret: "{{ image_pull_secret }}"
{% endif %}
  networkinfo:
    domain: "{{ console_domain }}"
  storage:
    console:
      class: "{{ console_storage_class }}"
      size: "{{ console_storage_size }}"
{%+ if console_tls_secret is defined %}
  tlsSecretName: "{{ console_tls_secret }}"
{% endif %}
{%+ if zones is defined %}
  clusterdata:
    zones:
{%+ for zone in zones %}
    - "{{ zone }}"
{% endfor %}
{% endif %}
{%+ if console_images is defined %}
  images:
    {{ console_images | to_nice_yaml(indent=2, width=1024) | indent(4, false) }}
{% endif %}
{%+ if console_versions is defined %}
  versions:
    {{ console_versions | to_nice_yaml(indent=2, width=1024) | indent(4, false) }}
{% endif %}
